<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- qtouchdevice.cpp -->
  <title>QTouchDevice Class | Qt GUI 5.14.2</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.14</a></td><td ><a href="qtgui-index.html">Qt GUI</a></td><td ><a href="qtgui-module.html">C++ Classes</a></td><td >QTouchDevice</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtgui-index.html">Qt 5.14.2 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QTouchDevice Class</h1>
<!-- $$$QTouchDevice-brief -->
<p>The QTouchDevice class describes the device from which touch events originate. <a href="#details">More...</a></p>
<!-- @@@QTouchDevice -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QTouchDevice&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += gui</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 5.0</td></tr></table></div><p>This class was introduced in Qt 5.0.</p>
<ul>
<li><a href="qtouchdevice-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> flags </td><td class="memItemRight bottomAlign"><b><a href="qtouchdevice.html#CapabilityFlag-enum">Capabilities</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qtouchdevice.html#CapabilityFlag-enum">CapabilityFlag</a></b> { Position, Area, Pressure, Velocity, RawPositions, &hellip;, MouseEmulation }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qtouchdevice.html#DeviceType-enum">DeviceType</a></b> { TouchScreen, TouchPad }</td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtouchdevice.html#QTouchDevice">QTouchDevice</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtouchdevice.html#dtor.QTouchDevice">~QTouchDevice</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTouchDevice::Capabilities </td><td class="memItemRight bottomAlign"><b><a href="qtouchdevice.html#capabilities">capabilities</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtouchdevice.html#maximumTouchPoints">maximumTouchPoints</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qtouchdevice.html#name">name</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtouchdevice.html#setCapabilities">setCapabilities</a></b>(QTouchDevice::Capabilities <i>caps</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtouchdevice.html#setMaximumTouchPoints">setMaximumTouchPoints</a></b>(int <i>max</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtouchdevice.html#setName">setName</a></b>(const QString &amp;<i>name</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtouchdevice.html#setType">setType</a></b>(QTouchDevice::DeviceType <i>devType</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTouchDevice::DeviceType </td><td class="memItemRight bottomAlign"><b><a href="qtouchdevice.html#type">type</a></b>() const</td></tr>
</table></div>
<a name="static-public-members"></a>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;const QTouchDevice *&gt; </td><td class="memItemRight bottomAlign"><b><a href="qtouchdevice.html#devices">devices</a></b>()</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QTouchDevice-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>Each <a href="qtouchevent.html">QTouchEvent</a> contains a QTouchDevice pointer to allow accessing device-specific properties like type and capabilities. It is the responsibility of the platform or generic plug-ins to register the available touch devices via QWindowSystemInterface before generating any touch events. Applications do not need to instantiate this class, they should just access the global instances pointed to by <a href="qtouchevent.html#device">QTouchEvent::device</a>().</p>
</div>
<!-- @@@QTouchDevice -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$CapabilityFlag$$$Position$$$Area$$$Pressure$$$Velocity$$$RawPositions$$$NormalizedPosition$$$MouseEmulation -->
<h3 class="flags" id="CapabilityFlag-enum"><a name="CapabilityFlag-enum"></a>enum QTouchDevice::<span class="name">CapabilityFlag</span><br/>flags QTouchDevice::<span class="name">Capabilities</span></h3>
<p>This enum is used with <a href="qtouchdevice.html#capabilities">QTouchDevice::capabilities</a>() to indicate what kind of information the touch device or its driver can provide.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QTouchDevice::Position</code></td><td class="topAlign tblval"><code>0x0001</code></td><td class="topAlign">Indicates that position information is available, meaning that the pos() family of functions in the touch points return valid points.</td></tr>
<tr><td class="topAlign"><code>QTouchDevice::Area</code></td><td class="topAlign tblval"><code>0x0002</code></td><td class="topAlign">Indicates that touch area information is available, meaning that the rect() family of functions in the touch points return valid rectangles.</td></tr>
<tr><td class="topAlign"><code>QTouchDevice::Pressure</code></td><td class="topAlign tblval"><code>0x0004</code></td><td class="topAlign">Indicates that pressure information is available, meaning that pressure() returns a valid value.</td></tr>
<tr><td class="topAlign"><code>QTouchDevice::Velocity</code></td><td class="topAlign tblval"><code>0x0008</code></td><td class="topAlign">Indicates that velocity information is available, meaning that velocity() returns a valid vector.</td></tr>
<tr><td class="topAlign"><code>QTouchDevice::RawPositions</code></td><td class="topAlign tblval"><code>0x0010</code></td><td class="topAlign">Indicates that the list returned by <a href="qtouchevent-touchpoint.html#rawScreenPositions">QTouchEvent::TouchPoint::rawScreenPositions</a>() may contain one or more positions for each touch point. This is relevant when the touch input gets filtered or corrected on driver level.</td></tr>
<tr><td class="topAlign"><code>QTouchDevice::NormalizedPosition</code></td><td class="topAlign tblval"><code>0x0020</code></td><td class="topAlign">Indicates that the normalized position is available, meaning that normalizedPos() returns a valid value.</td></tr>
<tr><td class="topAlign"><code>QTouchDevice::MouseEmulation</code></td><td class="topAlign tblval"><code>0x0040</code></td><td class="topAlign">Indicates that the device synthesizes mouse events. This enum value has been introduced in Qt 5.5&#x2e;</td></tr>
</table></div>
<p>The Capabilities type is a typedef for <a href="../qtcore/qflags.html">QFlags</a>&lt;CapabilityFlag&gt;. It stores an OR combination of CapabilityFlag values.</p>
<!-- @@@CapabilityFlag -->
<!-- $$$DeviceType$$$TouchScreen$$$TouchPad -->
<h3 class="fn" id="DeviceType-enum"><a name="DeviceType-enum"></a>enum QTouchDevice::<span class="name">DeviceType</span></h3>
<p>This enum represents the type of device that generated a <a href="qtouchevent.html">QTouchEvent</a>.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QTouchDevice::TouchScreen</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">In this type of device, the touch surface and display are integrated. This means the surface and display typically have the same size, such that there is a direct relationship between the touch points' physical positions and the coordinate reported by <a href="qtouchevent-touchpoint.html">QTouchEvent::TouchPoint</a>. As a result, Qt allows the user to interact directly with multiple QWidgets and QGraphicsItems at the same time.</td></tr>
<tr><td class="topAlign"><code>QTouchDevice::TouchPad</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">In this type of device, the touch surface is separate from the display. There is not a direct relationship between the physical touch location and the on-screen coordinates. Instead, they are calculated relative to the current mouse position, and the user must use the touch-pad to move this reference point. Unlike touch-screens, Qt allows users to only interact with a single <a href="../qtwidgets/qwidget.html">QWidget</a> or <a href="../qtwidgets/qgraphicsitem.html">QGraphicsItem</a> at a time.</td></tr>
</table></div>
<!-- @@@DeviceType -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QTouchDevice[overload1]$$$QTouchDevice -->
<h3 class="fn" id="QTouchDevice"><a name="QTouchDevice"></a>QTouchDevice::<span class="name">QTouchDevice</span>()</h3>
<p>Creates a new touch device instance. By default the name is empty, the only capability is Position and type is <a href="qtouchdevice.html#DeviceType-enum">TouchScreen</a>.</p>
<!-- @@@QTouchDevice -->
<!-- $$$~QTouchDevice[overload1]$$$~QTouchDevice -->
<h3 class="fn" id="dtor.QTouchDevice"><a name="dtor.QTouchDevice"></a>QTouchDevice::<span class="name">~QTouchDevice</span>()</h3>
<p>Destroys a touch device instance.</p>
<!-- @@@~QTouchDevice -->
<!-- $$$capabilities[overload1]$$$capabilities -->
<h3 class="fn" id="capabilities"><a name="capabilities"></a><span class="type"><a href="qtouchdevice.html#CapabilityFlag-enum">QTouchDevice::Capabilities</a></span> QTouchDevice::<span class="name">capabilities</span>() const</h3>
<p>Returns the touch device capabilities.</p>
<p><b>See also </b><a href="qtouchdevice.html#setCapabilities">setCapabilities</a>().</p>
<!-- @@@capabilities -->
<!-- $$$devices[overload1]$$$devices -->
<h3 class="fn" id="devices"><a name="devices"></a><code>[static] </code><span class="type">QList</span>&lt;const <span class="type"><a href="qtouchdevice.html#QTouchDevice">QTouchDevice</a></span> *&gt; QTouchDevice::<span class="name">devices</span>()</h3>
<p>Returns a list of all registered devices.</p>
<p><b>Note: </b>The returned list cannot be used to add new devices. To add a simulated touch screen for an autotest, <a href="../qttestlib/qtest.html#createTouchDevice">QTest::createTouchDevice</a>() can be used. To add real touch screens to QPA plugins, the private <code>QWindowSystemInterface::registerTouchDevice()</code> function can be used.</p><!-- @@@devices -->
<!-- $$$maximumTouchPoints[overload1]$$$maximumTouchPoints -->
<h3 class="fn" id="maximumTouchPoints"><a name="maximumTouchPoints"></a><span class="type">int</span> QTouchDevice::<span class="name">maximumTouchPoints</span>() const</h3>
<p>Returns the maximum number of simultaneous touch points (fingers) that can be detected.</p>
<p>This function was introduced in Qt 5.2.</p>
<p><b>See also </b><a href="qtouchdevice.html#setMaximumTouchPoints">setMaximumTouchPoints</a>().</p>
<!-- @@@maximumTouchPoints -->
<!-- $$$name[overload1]$$$name -->
<h3 class="fn" id="name"><a name="name"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QTouchDevice::<span class="name">name</span>() const</h3>
<p>Returns the touch device name.</p>
<p>This string may often be empty. It is however useful for systems that have more than one touch input device because there it can be used to differentiate between the devices (i.e&#x2e; to tell from which device a <a href="qtouchevent.html">QTouchEvent</a> originates from).</p>
<p><b>See also </b><a href="qtouchdevice.html#setName">setName</a>().</p>
<!-- @@@name -->
<!-- $$$setCapabilities[overload1]$$$setCapabilitiesQTouchDevice::Capabilities -->
<h3 class="fn" id="setCapabilities"><a name="setCapabilities"></a><span class="type">void</span> QTouchDevice::<span class="name">setCapabilities</span>(<span class="type"><a href="qtouchdevice.html#CapabilityFlag-enum">QTouchDevice::Capabilities</a></span> <i>caps</i>)</h3>
<p>Sets the capabilities <i>caps</i> supported by the device and its driver.</p>
<p><b>See also </b><a href="qtouchdevice.html#capabilities">capabilities</a>().</p>
<!-- @@@setCapabilities -->
<!-- $$$setMaximumTouchPoints[overload1]$$$setMaximumTouchPointsint -->
<h3 class="fn" id="setMaximumTouchPoints"><a name="setMaximumTouchPoints"></a><span class="type">void</span> QTouchDevice::<span class="name">setMaximumTouchPoints</span>(<span class="type">int</span> <i>max</i>)</h3>
<p>Sets the maximum number of simultaneous touchpoints <i>max</i> supported by the device and its driver.</p>
<p><b>See also </b><a href="qtouchdevice.html#maximumTouchPoints">maximumTouchPoints</a>().</p>
<!-- @@@setMaximumTouchPoints -->
<!-- $$$setName[overload1]$$$setNameconstQString& -->
<h3 class="fn" id="setName"><a name="setName"></a><span class="type">void</span> QTouchDevice::<span class="name">setName</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>name</i>)</h3>
<p>Sets the <i>name</i> (a unique identifier) for the device. In most systems it is enough to leave this unset and keep the default empty name. This identifier becomes important when having multiple touch devices and a need to differentiate between them.</p>
<p><b>See also </b><a href="qtouchdevice.html#name">name</a>().</p>
<!-- @@@setName -->
<!-- $$$setType[overload1]$$$setTypeQTouchDevice::DeviceType -->
<h3 class="fn" id="setType"><a name="setType"></a><span class="type">void</span> QTouchDevice::<span class="name">setType</span>(<span class="type"><a href="qtouchdevice.html#DeviceType-enum">QTouchDevice::DeviceType</a></span> <i>devType</i>)</h3>
<p>Sets the device type <i>devType</i>.</p>
<p><b>See also </b><a href="qtouchdevice.html#type">type</a>().</p>
<!-- @@@setType -->
<!-- $$$type[overload1]$$$type -->
<h3 class="fn" id="type"><a name="type"></a><span class="type"><a href="qtouchdevice.html#DeviceType-enum">QTouchDevice::DeviceType</a></span> QTouchDevice::<span class="name">type</span>() const</h3>
<p>Returns the touch device type.</p>
<p><b>See also </b><a href="qtouchdevice.html#setType">setType</a>().</p>
<!-- @@@type -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2020 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
